package com.csdj.mapper;

import com.csdj.pojo.LoginRecord;
import com.csdj.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {
    /**
     * 登录
     *
     * @param userName
     * @param passWord
     * @return
     */
    public List<User> selectAll(@Param("userName") String userName, @Param("passWord") String passWord);

    /**
     * 新增一个登录记录
     *
     * @param loginRecord
     * @return
     */
    public int insertLoginRecord(LoginRecord loginRecord);

    /**
     * 修改最近登录时间
     */
    public int updateLoginLastTime(@Param("id") long id, @Param("data") String data, @Param("ip") String ip);

    /**
     * 注册
     *
     * @param user
     * @return
     */
    public int insertUser(User user);

    public List<User> selectAllByRole(Integer role);

    public Integer updatePwd(String pwd, Integer id);
}